package com.jia.lidao.ui.personal.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.jia.lidao.utils.LogUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by jia on 17/12/16.
 */

public class TabAdapter extends FragmentStatePagerAdapter {

    private List<Fragment> fragments;
    private String[] titles;


    public TabAdapter(FragmentManager fm, List<Fragment> fragments,String[] titles) {
        super(fm);
        this.fragments=new ArrayList<>();
        this.fragments.addAll(fragments);
        this.titles=titles;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
